var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2EventCenter = require("EventCenter");
var $2MiniPlatform = require("MiniPlatform");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_wxsub = /* */function (_cc$Component43) {
  function _ctor() {
    var _this196;
    babel_classCallCheck(this, _ctor);
    _this196 = _callSuper(this, _ctor, arguments);
    _this196.bg = null;
    _this196.close = null;
    _this196.isshow = false;
    return _this196;
  }
  babel_inherits(_ctor, _cc$Component43);
  return babel_createClass(_ctor, [{
    key: "onLoad",
    value: function onLoad() {
      var _this197 = this;
      this.isshow = this.node.active;
      $2EventCenter.default.regisEvent("showwxsub", function () {
        _this197.unscheduleAllCallbacks();
        _this197.node.active = true;
        _this197.isshow = true;
        console.log("开放域显示");
      }, this);
      $2EventCenter.default.regisEvent("hidwxsub", function () {
        _this197.node.active = false;
        _this197.isshow = false;
        console.log("开放域隐藏");
      }, this);
      $2EventCenter.default.regisEvent("showbigrank", function () {
        _this197.bg.active = true;
        _this197.close.active = true;
      }, this);
      $2EventCenter.default.regisEventOnce("loadSub", this.loadSub, this);
    }
  }, {
    key: "loadSub",
    value: function loadSub() {
      var _this198 = this;
      this.node.active = true;
      cc.loader.loadRes("sub/wxsub", cc.Prefab, function (e, t) {
        if (!e) {
          var _e110 = cc.instantiate(t);
          _e110.setParent(_this198.node);
          _e110.zIndex = 1;
          _this198.node.active = _this198.isshow;
        }
      });
    }
  }, {
    key: "closeBigrank",
    value: function closeBigrank() {
      this.bg.active = false;
      this.close.active = false;
      $2MiniPlatform.default.Instance.onPostMessage({
        message: "closeBigrank"
      });
    }
  }]);
}(cc.Component);
cc__decorate([ccp_property(cc.Node)], def_wxsub.prototype, "bg", undefined);
cc__decorate([ccp_property(cc.Node)], def_wxsub.prototype, "close", undefined);
def_wxsub = cc__decorate([ccp_ccclass], def_wxsub);
exports.default = def_wxsub;